package cn.cdeden.knowledge.controller.team;

import cn.cdeden.common.core.utils.page.TableDataInfo;

import cn.cdeden.common.core.domain.R;
import cn.cdeden.knowledge.domain.dto.TeamFilesReviewDto;
import cn.cdeden.knowledge.domain.dto.TeamFilesReviewQueryParam;
import cn.cdeden.knowledge.service.TeamFilesReviewService;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.Set;

/**
* @author Chen
* @date 2023-11-23
**/
@RestController
@RequiredArgsConstructor
//@Api(tags = "团队文档评论管理")
@RequestMapping("/api/teamFilesReview")
public class TeamFilesReviewController {

    private final TeamFilesReviewService teamFilesReviewService;

//    @Log("查询团队文档评论")
//    @ApiOperation("查询团队文档评论")
    @GetMapping(value = "/query")
    public R<TableDataInfo<TeamFilesReviewDto>> query(TeamFilesReviewQueryParam query, Pageable pageable){
        TableDataInfo<TeamFilesReviewDto> info = teamFilesReviewService.queryAll(query,pageable);
        return R.ok(info);
    }

//    @Log("添加团队文档评论")
//    @ApiOperation("添加团队文档评论")
    @PostMapping(value = "/add")
    public R create(@Validated @RequestBody TeamFilesReviewDto resources){
        return R.ok(teamFilesReviewService.insert(resources));
    }

    @PutMapping
//    @Log("修改团队文档评论")
//    @ApiOperation("修改团队文档评论")
    public R update(@Validated @RequestBody TeamFilesReviewDto resources){
        return R.ok(teamFilesReviewService.updateById(resources));
    }

//    @Log("删除团队文档评论")
//    @ApiOperation("删除团队文档评论")
    @DeleteMapping(value = "delete")
    public R delete(@RequestBody Set<Long> ids) {
        return R.ok(teamFilesReviewService.deleteByIds(ids));
    }

    /*
//    @Log("导出团队文档评论")
//    @ApiOperation("导出团队文档评论")
    @GetMapping(value = "/download")
    @PreAuthorize("@el.check('teamFilesReview:list')")
    public void download(HttpServletResponse response, TeamFilesReviewQueryParam query) throws IOException {
        teamFilesReviewService.download(teamFilesReviewService.queryAll(query), response);
    }*/

}
